//============================================================================
// Name        : Found.cpp
// Author      : Anthea Neums, Jonas Halbach
//			   :
// Description : This Class Found is used to
//				 store the positions where the pattern and the genom match.
//============================================================================

#include "Found.h"



namespace algorithm {

using namespace std;

Found::Found(int genomPosition, int patternPosition, int matchingLength, char *string) {
	this->genomPosition = genomPosition;
	this->patternPosition = patternPosition;
	this->matchingLength = matchingLength;
	this->string = string;
}

int Found::getGenomPosition()
{
	return genomPosition;
}

void Found::setGenomPosition(int genomPosition)
{
	this->genomPosition = genomPosition;
}

int Found::getPatternPosition()
{
	return patternPosition;
}

void Found::setPatternPosition(int patternPosition)
{
	this->patternPosition = patternPosition;
}

int Found::getMatchingLength()
{
	return matchingLength;
}

void Found::setMatchingLength(int matchingLength)
{
	this -> matchingLength = matchingLength;
}

void Found::setString(char *string)
{
	this->string = string;
}

char *Found::getString()
{
	return string;
}

void Found::print()
{
	cout << "\tPosition " << genomPosition <<": \t" << string << ";\t Pattern-Position: " << patternPosition << endl;
}

bool Found::operator == (const Found *found)
{
	return genomPosition == found->genomPosition &&
			patternPosition == found->patternPosition &&
			matchingLength == found-> matchingLength &&
			strcmp(string, found->string) == 0;
}

bool Found::operator != (const Found *found)
{
	return genomPosition != found->genomPosition ||
			patternPosition != found->patternPosition ||
			matchingLength != found-> matchingLength ||
			strcmp(string, found->string) != 0;
}

bool Found::operator == (const Found found)
{
	return genomPosition == found.genomPosition &&
			patternPosition == found.patternPosition &&
			matchingLength == found. matchingLength &&
			strcmp(string, found.string) == 0;
}

bool Found::operator != (const Found found)
{
	return genomPosition != found.genomPosition ||
			patternPosition != found.patternPosition ||
			matchingLength != found. matchingLength ||
			strcmp(string, found.string) != 0;
}

Found::~Found() {
	delete string;
}

} /* namespace algorithm */
